<template>
  <div class="main">
    <el-container class="container">
      <el-aside class="aside" :width="isCollapse ? '60px' : '210px'">
        <nav-menu :collapse="isCollapse" />
      </el-aside>
      <el-container>
        <el-header class="header"
          ><nav-header @foldChange="handleFoldChange" />
        </el-header>
        <el-main class="main">
          <div class="show">
            <router-view></router-view>
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed, ref } from "vue";
import NavHeader from "@/components/nav-header/NavHeader.vue";
import NavMenu from "@/components/nav-menu/NavMenu.vue";
export default defineComponent({
  name: "main",
  setup() {
    const isCollapse = ref(false);
    const handleFoldChange = (fold: boolean) => {
      console.log(fold);
      isCollapse.value = fold;
    };

    return { handleFoldChange, isCollapse };
  },
  components: {
    NavMenu,
    NavHeader,
  },
});
</script>

<style lang="less" scoped>
.container {
  height: 100%;
  .aside {
    height: 100vh;
    background: #021326;
  }
  .header {
    background: #fff;
  }
  .main {
    background: #ccc;
    .show {
      background: #fff;
      border-radius: 5px;
    }
  }
}
</style>
